package com.bdqn;

import com.bdqn.dao.NewsDao;
import com.bdqn.entity.News;
import com.bdqn.factory.SimpleDaoFactory;
import com.bdqn.service.impl.NewsServiceImpl;
import com.bdqn.util.PropUtil;

/**
 * Test01
 *
 * @author LILIBO
 * @since 2021-10-08
 */
public class Test01 {

    public static void main(String[] args) {
        // 在调用的地方生产一个NewsDao的实例对象
        NewsDao dao = SimpleDaoFactory.getInstance(PropUtil.getProperty("dbName"));
        NewsServiceImpl newsService = new NewsServiceImpl();
        // 使用NewsServiceImpl类中提供的方法将所需要依赖的对象传入
        newsService.setDao(dao);
        newsService.save(new News());
    }
}
